<script>
var Map = function () {
	var map = new Object();
	
	this.add = function(key, value) {
		if(!key || typeof key==undefined) {
			return;
		}
		
		map[key] = value;
	}
	
	this.remove = function(key) {
		delete map[key];
	}
	
	this.get = function(key) {
		if(map[key]==undefined) {
			return null;
		}
		
		return map[key];
	}
}

var LogisticsCompany = function(companyType){
	var type = companyType;
	var companyList = new Map();
	
	companyList.add('POST', {
		  "_id": "POST",
		  "reg_mail_no": "",
		  "id": 1,
		  "name": "\u4e2d\u56fd\u90ae\u653f\u5e73\u90ae"
		});
	companyList.add('EMS', {
		  "_id": "EMS",
		  "reg_mail_no": "^[A-Z]{2}[0-9]{9}[A-Z]{2}$|^(10)[0-9]{11}$",
		  "id": 2,
		  "name": "EMS"
		});
	companyList.add('YTO', {
		  "_id": "YTO",
		  "reg_mail_no": "^(0|1|2|3|5|6|7|8|E|D|F|G|V|W|e|d|f|g|v|w)[0-9]{9}$",
		  "id": 101,
		  "name": "\u5706\u901a\u901f\u9012"
		});
	companyList.add('ZTO', {
		  "_id": "ZTO",
		  "reg_mail_no":
    "^((618|680|778|768|688|618|828|988|118|888|571|518|010|628|205|880|717|718|728|738|761|762|763|701|757)[0-9]{9})$|^((2008|2010|8050|7518)[0-9]{8})$",
		  "id": 500,
		  "name": "\u4e2d\u901a\u901f\u9012"
		});
	companyList.add('ZJS', {
		  "_id": "ZJS",
		  "reg_mail_no": "^[a-zA-Z0-9]{10}$",
		  "id": 103,
		  "name": "\u5b85\u6025\u9001"
		});
	companyList.add('HZABC', {
		  "_id": "HZABC",
		  "reg_mail_no": "^[0-9]{10,11}$",
		  "id": 1121,
		  "name": "\u676d\u5dde\u7231\u5f7c\u897f"
		});
	companyList.add('YUNDA', {
		  "_id": "YUNDA",
		  "reg_mail_no": "^[0-9]{13}$",
		  "id": 102,
		  "name": "\u97f5\u8fbe\u5feb\u8fd0"
		});
	companyList.add('TTKDEX', {
		  "_id": "TTKDEX",
		  "reg_mail_no": "^[0-9]{12,14}$",
		  "id": 504,
		  "name": "\u5929\u5929\u5feb\u9012"
		});
	companyList.add('FEDEX', {
		  "_id": "FEDEX",
		  "reg_mail_no": "^[0-9]{12}$",
		  "id": 106,
		  "name": "\u8054\u90a6\u5feb\u9012"
		});
	companyList.add('EBON', {
		  "_id": "EBON",
		  "reg_mail_no": "^[0-9]{10}$",
		  "id": 1036,
		  "name": "\u4e00\u90a6\u901f\u9012"
		});
	companyList.add('STARS', {
		  "_id": "STARS",
		  "reg_mail_no": "^[0-9]{10}$",
		  "id": 1007,
		  "name": "\u661f\u6668\u6025\u4fbf"
		});
	companyList.add('DBL', {
		  "_id": "DBL",
		  "reg_mail_no": "^[0-9]?[0-9]{7}$",
		  "id": 107,
		  "name": "\u5fb7\u90a6\u7269\u6d41"
		});
	companyList.add('CRE', {
		  "_id": "CRE",
		  "reg_mail_no": "^K[0-9]{11}$",
		  "id": 1016,
		  "name": "\u4e2d\u94c1\u5feb\u8fd0"
		});
	companyList.add('SHQ', {
		  "_id": "SHQ",
		  "reg_mail_no": "^[A-Za-z0-9]*[0|2|4|6|8]$",
		  "id": 108,
		  "name": "\u534e\u5f3a\u7269\u6d41"
		});
	companyList.add('HTKY', {
		  "_id": "HTKY",
		  "reg_mail_no": "^(A|B|C|D|E|H|0)(D|X|[0-9])(A|[0-9])[0-9]{10}$|^(21|22|23|24|25|26|27|28|29|30|31|32|33|34|35|36|37|38|39)[0-9]{10}$",
		  "id": 502,
		  "name": "\u6c47\u901a\u5feb\u8fd0"
		});
	companyList.add('WLB-STARS', {
		  "_id": "WLB-STARS",
		  "reg_mail_no": "^TB[0-9]{12}$",
		  "id": 1201,
		  "name": "\u661f\u8fb0\u6025\u4fbf"
		});
	companyList.add('WLB-SAD', {
		  "_id": "WLB-SAD",
		  "reg_mail_no": "^TB[0-9]{12}$",
		  "id": 1199,
		  "name": "\u8d5b\u6fb3\u9012"
		});
	companyList.add('WLB-ABC', {
		  "_id": "WLB-ABC",
		  "reg_mail_no": "^TB[0-9]{12}$",
		  "id": 1198,
		  "name": "\u6d59\u6c5fABC"
		});
	companyList.add('SF', {
		  "_id": "SF",
		  "reg_mail_no": "^[0-9]{12}$",
		  "id": 505,
		  "name": "\u987a\u4e30\u901f\u8fd0"
		});
	companyList.add('AIRFEX', {
		  "_id": "AIRFEX",
		  "reg_mail_no": "",
		  "id": 507,
		  "name": "\u4e9a\u98ce"
		});
	companyList.add('APEX', {
		  "_id": "APEX",
		  "reg_mail_no": "",
		  "id": 508,
		  "name": "\u5168\u4e00"
		});
	companyList.add('LB', {
		  "_id": "LB",
		  "reg_mail_no": "^[0-9]{12}$",
		  "id": 510,
		  "name": "\u9f99\u90a6\u5feb\u9012"
		});
	companyList.add('CYEXP', {
		  "_id": "CYEXP",
		  "reg_mail_no": "",
		  "id": 511,
		  "name": "\u957f\u5b87"
		});
	companyList.add('DTW', {
		  "_id": "DTW",
		  "reg_mail_no": "",
		  "id": 512,
		  "name": "\u5927\u7530"
		});
	companyList.add('YUD', {
		  "_id": "YUD",
		  "reg_mail_no": "",
		  "id": 513,
		  "name": "\u957f\u53d1"
		});
	companyList.add('ANTO', {
		  "_id": "ANTO",
		  "reg_mail_no": "",
		  "id": 1008,
		  "name": "\u5b89\u5f97"
		});
	companyList.add('CCES', {
		  "_id": "CCES",
		  "reg_mail_no": "^(2|3|5|6|8|5|1)[0-9]{9}$",
		  "id": 501,
		  "name": "CCES"
		});
	companyList.add('STO', {
		  "_id": "STO",
		  "reg_mail_no": "^(268|888|588|688|368|468|568|668|768|868|968)[0-9]{9}$|^(268|888|588|688|368|468|568|668|768|868|968)[0-9]{10}$|^(STO)[0-9]{10}$",
		  "id": 100,
		  "name": "\u7533\u901aE\u7269\u6d41"
		});
	companyList.add('ZY', {
		  "_id": "ZY",
		  "reg_mail_no": "^CO[A-Z]{2}[0-9]{10}$",
		  "id": 1140,
		  "name": "\u4e2d\u8fdc"
		});
	companyList.add('YCT', {
		  "_id": "YCT",
		  "reg_mail_no": "^[0-9]{12}$",
		  "id": 1185,
		  "name": "\u9ed1\u732b\u5b85\u6025\u4fbf"
		});
	companyList.add('DFH', {
		  "_id": "DFH",
		  "reg_mail_no": "^[0-9]{10}$",
		  "id": 1137,
		  "name": "\u4e1c\u65b9\u6c47"
		});
	companyList.add('YC', {
		  "_id": "YC",
		  "reg_mail_no": "^96[0-9]{12}$",
		  "id": 1139,
		  "name": "\u8fdc\u957f"
		});
	companyList.add('XB', {
		  "_id": "XB",
		  "reg_mail_no": "[0-9]{8}",
		  "id": 1186,
		  "name": "\u65b0\u90a6\u7269\u6d41"
		});
	companyList.add('SY', {
		  "_id": "SY",
		  "reg_mail_no": "^29[0-9]{8}$",
		  "id": 1138,
		  "name": "\u9996\u4e1a"
		});
	companyList.add('NEDA', {
		  "_id": "NEDA",
		  "reg_mail_no": "^((88|)[0-9]{10})$|^((1|2|3|5|)[0-9]{9})$",
		  "id": 1192,
		  "name": "\u6e2f\u4e2d\u80fd\u8fbe"
		});
	companyList.add('QRT', {
		  "_id": "QRT",
		  "reg_mail_no": "^[0-9]{12}$",
		  "id": 1208,
		  "name": "\u5168\u65e5\u901a\u5feb\u9012"
		});
	companyList.add('UC', {
		  "_id": "UC",
		  "reg_mail_no": "^VIP[0-9]{9}|V[0-9]{11}|[0-9]{12}$",
		  "id": 1207,
		  "name": "\u4f18\u901f\u7269\u6d41"
		});
	companyList.add('XFHONG', {
		  "_id": "XFHONG",
		  "reg_mail_no": "^[0-9]{10,}$",
		  "id": 1194,
		  "name": "\u946b\u98de\u9e3f\u5feb\u9012"
		});
	companyList.add('FAST', {
		  "_id": "FAST",
		  "reg_mail_no": "^[0-9]{11,13}$",
		  "id": 1204,
		  "name": "\u5feb\u6377\u901f\u9012"
		});
	companyList.add('OTHER', {
		  "_id": "OTHER",
		  "reg_mail_no": "",
		  "id": -1,
		  "name": "\u5176\u4ed6"
		});
	companyList.add('QFKD', {
		  "_id": "QFKD",
		  "reg_mail_no": "^[0-9]{12}$",
		  "id": 1216,
		  "name": "\u5317\u4eac\u5168\u5cf0"
		});
    companyList.add('E邮宝', {
        "_id": "E邮宝",
        "reg_mail_no": "^[A-Z]{2}[0-9]{9}[A-Z]{2}$",
        "id": 2,
        "name": "E\u90ae\u5b9d"
      });
    companyList.add('POSTB', {

        "_id": "POSTB",
        "reg_mail_no": "^[GA]{2}[0-9]{9}([2-5][0-9]|[1][1-9]|[6][0-5])$|^[99]{2}[0-9]{11}$",
        "id": 200734,
        "name": "\u90ae\u653f\u56fd\u5185\u5c0f\u5305"
      });
      companyList.add('EYB', {
        "_id": "EYB",
        "reg_mail_no": "^(50|51)[0-9]{11}$",
        "id": 3,
        "name": "EMS\u7ecf\u6d4e\u5feb\u9012"
      }); 
	this.check = function(bn) {
		var info = companyList.get(type);
		if(info == null) {
			return true;
		}
		
		var reg = new RegExp(info.reg_mail_no);
		
		return reg.test(bn);
	}
	
	this.getCompany = function(){
		return companyList.get(type);
	}
}

</script>
